Skip to content

Conversation

@zenoachtig
Copy link
Contributor

@zenoachtig zenoachtig commented Nov 25, 2025

  • Update the embedded frame to support sites without assistant, by including two tabs: "Assistant" and "Docs". The right tabs will be loaded by default, but can be overridden with local configuration options.
  • Restyle the embed frame with a sidebar for tabs + custom actions
  • Add a trademark to the embed frame
  • Tweak some in-site components to display properly in the embed frame
  • Update the embed docs

Tests are added in separate PR: #3830

@changeset-bot
Copy link

changeset-bot bot commented Nov 25, 2025

🦋 Changeset detected

Latest commit: ea61a93

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@gitbook/embed Minor
gitbook Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@argos-ci
Copy link

argos-ci bot commented Nov 25, 2025

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
customers-v2 (Inspect) ✅ No changes detected - Dec 2, 2025, 6:01 PM
v2-cloudflare (Inspect) ⚠️ Changes detected (Review) 39 changed Dec 2, 2025, 6:05 PM
v2-vercel (Inspect) ⚠️ Changes detected (Review) 36 changed Dec 2, 2025, 6:06 PM

@zenoachtig zenoachtig removed the request for review from SamyPesse December 2, 2025 09:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the GitBook Docs Embed to support sites without an assistant by introducing a tabbed interface with "Assistant" and "Docs" tabs. The changes include a redesigned sidebar for tab navigation and custom actions, a new trademark display in the embed frame, and updated styling for better presentation in embedded contexts.

Key changes:

  • Added a tabbed interface (Assistant/Docs) with automatic tab selection based on site configuration
  • Introduced a sidebar layout for tabs and custom action buttons
  • Renamed buttons to actions in the embed configuration (with backward compatibility)
  • Added trademark display at the bottom of the embed frame
  • Enhanced component flexibility (Button, Tooltip, Link) to support embed-specific use cases

Reviewed changes

Copilot reviewed 31 out of 32 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/gitbook/src/middleware.ts Added new ~gitbook/embed route for the main embed entry point
packages/gitbook/src/lib/embeddable.ts Added toLinkForContent to handle relative links in embed context
packages/gitbook/src/components/primitives/Tooltip.tsx Exported TooltipProps type for external configuration
packages/gitbook/src/components/primitives/Link.tsx Fixed navigation context to handle target="_blank" links
packages/gitbook/src/components/primitives/Button.tsx Added tooltipProps support and improved icon element handling
packages/gitbook/src/components/TableOfContents/Trademark.tsx Added className prop for custom styling in embed context
packages/gitbook/src/components/TableOfContents/TableOfContents.tsx Added className prop for external styling
packages/gitbook/src/components/SiteSections/SiteSectionTabs.tsx Updated viewport positioning calculations for container-aware layout
packages/gitbook/src/components/Header/HeaderMobileMenu.tsx Converted to use Button component with active state tracking
packages/gitbook/src/components/Embeddable/EmbeddableRootLayout.tsx Added trademark display and updated theme handling for embeds
packages/gitbook/src/components/Embeddable/EmbeddableIframeAPI.tsx Implemented tab management, navigation logic, and actions configuration
packages/gitbook/src/components/Embeddable/EmbeddableFrame.tsx Added EmbeddableFrameMain and EmbeddableFrameSidebar components
packages/gitbook/src/components/Embeddable/EmbeddableDocsPageControlButtons.tsx New component for "open in new tab" button in docs view
packages/gitbook/src/components/Embeddable/EmbeddableDocsPage.tsx Restructured to use new sidebar layout with tabs and actions
packages/gitbook/src/components/Embeddable/EmbeddableAIChat.tsx Updated to use new sidebar layout structure
packages/gitbook/src/components/AIChat/AIChatControlButton.tsx Simplified from dropdown to single clear button
packages/gitbook/src/components/AIChat/AIChat.tsx Updated to use EmbeddableFrameMain wrapper
packages/gitbook/src/components/AI/useAIChat.tsx Added event listener support for postMessage events
packages/gitbook/src/components/AI/useAI.tsx Added size class to AI chat icon
packages/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/~gitbook/embed/page.tsx New page that redirects to assistant or docs based on configuration
packages/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/~gitbook/embed/assistant/page.tsx Added redirect guard for when assistant is not enabled
packages/gitbook/src/app/sites/dynamic/[mode]/[siteURL]/[siteData]/~gitbook/embed/page.tsx New dynamic page with similar redirect logic
packages/embed/src/standalone/style.css Added icon styles for sparkle, help, and book icons
packages/embed/src/standalone/index.ts Renamed buttons to actions, added tabs configuration, and button customization
packages/embed/src/react/GitBookFrame.tsx Updated to use new configuration structure with actions and greeting
packages/embed/src/client/protocol.ts Renamed GitBookEmbeddableButtonDefinition to GitBookEmbeddableActionDefinition, added tabs field
packages/embed/src/client/createGitBookFrame.ts Updated default configuration structure
packages/embed/src/client/createGitBook.ts Changed default frame URL to use base embed path
packages/embed/README.md Comprehensive documentation update with new configuration options and examples
package.json Updated @gitbook/api dependency to version 0.152.0
bun.lock Updated lockfile to reflect new dependency version
.changeset/grumpy-peas-hammer.md Added changeset documenting the improvements

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const chatController = useAIChatController();

React.useEffect(() => {
embeddableConfiguration.setState({ baseURL, siteTitle });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the need to store baseURL and siteTitle in a global store when we have it on the context. Why can't we just use it from there?

Copy link
Contributor Author

@zenoachtig zenoachtig Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a client component, we don't want to send the whole context to the client so have to be selective. Unless I fundamentally misunderstand how context is supposed to work in GBO

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants